Skip to content

Fix OpenAPI multipart file field uploads - #1530

Merged
RhysSullivan merged 3 commits into
UsefulSoftwareCo:mainfrom
BittuBarnwal7479:fix-openapi-multipart-file-fields
Aug 28, 2026
Merged

Fix OpenAPI multipart file field uploads#1530
RhysSullivan merged 3 commits into
UsefulSoftwareCo:mainfrom
BittuBarnwal7479:fix-openapi-multipart-file-fields

Conversation

@BittuBarnwal7479

@BittuBarnwal7479 BittuBarnwal7479 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Fix OpenAPI multipart format: binary fields so they are exposed as ToolFile inputs and sent as real multipart file parts instead of plain form fields.

Partially addresses #1401 — inline multipart schemas only. $ref-referenced request bodies (including the reported Paperless case) still keep their declared binary strings; see the changeset for why, and a $defs-aware rewrite is the follow-up.

Changes

  • Map multipart binary string fields to the existing ToolFile input schema.
  • Convert ToolFile values into multipart file parts with bytes, filename, and content type.
  • Add a regression test for a Paperless-style PDF upload field.

Tests

  • bun run --cwd packages/plugins/openapi test non-json-body.test.ts
  • bun run --cwd packages/plugins/openapi typecheck

@BittuBarnwal7479
BittuBarnwal7479 force-pushed the fix-openapi-multipart-file-fields branch from d312a1d to e0a102c Compare August 4, 2026 16:07
@BittuBarnwal7479

Copy link
Copy Markdown
Author

@RhysSullivan pls review.

@RhysSullivan
RhysSullivan force-pushed the fix-openapi-multipart-file-fields branch from 276ace3 to 6e771fd Compare August 28, 2026 04:36
Convert tool-file arrays into real file parts before the per-part
encoding contentType branch, so a file array is no longer JSON-stringified
into one part. A file whose base64 payload does not decode now fails the
invocation and names the field instead of sending the envelope as JSON.

Scope the extract-side rewrite to the request schema properties map, and
within it to a binary property or the direct items of an array property —
the two shapes the form encoder builds parts from. Nested files and $ref
bodies stay as declared. Descriptions, titles, and nullability carry onto
the file schema.
@RhysSullivan
RhysSullivan merged commit 85b1955 into UsefulSoftwareCo:main Aug 28, 2026
40 checks passed
This was referenced Aug 28, 2026
@BittuBarnwal7479
BittuBarnwal7479 deleted the fix-openapi-multipart-file-fields branch August 28, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants